package com.gt.web.controller.app;

import com.gt.app.domain.dto.EsLifeWayInfoDto;
import com.gt.app.service.EsLifeWayInfoService;
import com.gt.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 生活方式信息 前端控制器
 * </p>
 *
 * @author caidesheng
 */
@Slf4j
@RestController
@RequestMapping("esLifeWayInfo")
@Api(tags = "生活方式信息接口")
public class EsLifeWayInfoController {

    @Autowired
    private EsLifeWayInfoService esLifeWayInfoService;

    @ApiOperation(value = "新增生活方式信息")
    @PostMapping(value = "add")
    public AjaxResult add(@RequestBody EsLifeWayInfoDto esLifeWayInfoDto) {
        esLifeWayInfoService.add(esLifeWayInfoDto);
        return AjaxResult.success();
    }

    @ApiOperation(value = "根据checkId获取生活方式信息")
    @GetMapping(value = "getLifeWayInfo")
    public AjaxResult getLifeWayInfo(String checkId) {
        EsLifeWayInfoDto esLifeWayInfoDto = esLifeWayInfoService.getLifeWayInfo(checkId);
        return AjaxResult.success(esLifeWayInfoDto);
    }
}
